package com.hm.hall.commons.constans;


import com.hm.hall.commons.constans.po.GradeCfgPO;
import com.hm.hall.commons.constans.po.ShortGradeCfgPO;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Luhong
 */
public class GameConstans {

    /*
     * 用户在房间的状态 -1 :离开,0 旁观 :1 游戏中,2:等待离开(留座离桌)
     */
    public final static short USER_IN_ROOM_STATUS_OUT = -1, USER_IN_ROOM_STATUS_LOOK = 0, USER_IN_ROOM_STATUS_IN = 1, USER_IN_ROOM_STATUS_WAIT_OUT = 2;
    // 默认的头像
    //
    public static final String DEFAULT_AVATAR = "http://wepoker.cdn.bcebos.com/img/default_user_avatar.png";
    public static final String BAIDU_MAP_AK = "Nigm4hdtONcvsGNBr2fxPUFwAk08XQGq";// 百度地图AK
    //http://hoomic-pub.oss-cn-hangzhou.aliyuncs.com/wepoker/default_avatar/default_user_avatar.png
    /**
     * 性别0 未设置	1男 2 女
     */
    public static final short SEX_UNKNOW = 0, SEX_MAN = 1, SEX_WOMAN = 2;
    /**
     * 1等待, 2游戏中, 4弃牌,101:等待入座,102 等待房主同意 ，103留座离桌
     */
    public final static int USER_GAME_STATUS_WAIT = 1, USER_GAME_STATUS_PLAYING = 2, USER_GAME_STATUS_FOLD = 4, USER_GAME_STATUS_WAIT_SIT = 101, USER_GAME_STATUS_WAIT_APPLY = 102, USER_GAME_STATUS_LEAVE = 103;
    // 游戏房间自动销毁时间
    public static final int ROOM_AUTO_DEST_HOUR = 9;
    /**
     * 帐号状态    (推广员/用户 通用)
     * 0:正常,1:停用, 2:删除,3:未激活,4待审核；5已搁置
     */
    public static final short USER_STATE_OK = 0, USER_STATE_DISABLE = 1, USER_STATE_DEL = 2, USER_STATE_NONACTIVATED = 3,
            USER_STATE_WAIT_AUDIT = 4, USER_STATE_SHELVE = 5;
    /**
     * 用户资格  0 : 普通用户, 10:测试用户
     */
    public static final int USER_QUALIFY_GENERAL = 0, USER_QUALIFY_TEST = 10;
    /**
     * 设备类型 1 :h5 , 2:ios ,3: Android
     */
    public static final int DEVICE_TYPE_H5 = 1, DEVICE_TYPE_H5_SIMPLE = 10, DEVICE_TYPE_IOS = 2, DEVICE_TYPE_ANDROID = 3, DEVICE_TYPE_IOS_AUDIT = 4;
    public static final int OPT_TIME_SEC = 12;
    // 充值商品渠道, 1:微信,2:苹果内购
    public static final short PRODUCT_PAY_CHANNEL_IAP = 1, PRODUCT_PAY_CHANNEL_WEIXIN = 0;
    //房间状态 1 关闭 ，2进行中 3 等待 4销毁 5暂停
    public final static short ROOM_STATUS_CLOSE = 1, ROOM_STATUS_PLAYING = 2, ROOM_STATUS_WAIT = 5, ROOM_STATUS_DESTROY = 4, ROOM_STATUS_PAUSE = 3;
    // 用户在线状态... 1: 在线, 0:离线
    public final static short USER_ONLINE = 1, USER_OFFLINE = 0;
    //************************** CFG ***************************//
    public static final List<Integer> DURATION_CFG = new ArrayList<Integer>() {
        private static final long serialVersionUID = 12569566767675L;

        {
            add(30);
            add(60);
            add(120);
            add(180);
            add(300);
        }
    };
    public static final List<Integer> GAME_PERSON_CFG = new ArrayList<Integer>() {
        private static final long serialVersionUID = 12565667676675L;

        {
            add(2);
            add(6);
            add(9);
        }
    };
    /**
     * 普通模式等级配置信息
     */
    public static final Map<Integer, GradeCfgPO> GRADE_MAP_CFG = new HashMap<Integer, GradeCfgPO>() {
        private static final long serialVersionUID = 12565667617675L;

        {
//			put(1, new GradeCfgPO(2, 1, 0, 200,2,1));
//			put(2, new GradeCfgPO(4, 2, 1, 400,4,2));
//			put(3, new GradeCfgPO(10, 5, 2, 1000,10,5));
//			put(4, new GradeCfgPO(20, 10, 5, 2000,20,10));
//			put(5, new GradeCfgPO(50, 25, 10, 5000,50,25));
//			put(6, new GradeCfgPO(100, 50, 25, 10000,100,50));

            put(1, new GradeCfgPO(2, 1, 200, 2, 1));
            put(2, new GradeCfgPO(4, 2, 400, 4, 2));
            put(3, new GradeCfgPO(10, 5, 1000, 10, 5));
            put(4, new GradeCfgPO(20, 10, 2000, 20, 10));
            put(5, new GradeCfgPO(50, 25, 5000, 50, 25));
            put(6, new GradeCfgPO(100, 50, 10000, 100, 50));

            put(7, new GradeCfgPO(6, 3, 600, 6, 3));
            put(8, new GradeCfgPO(8, 4, 800, 8, 4));
            put(9, new GradeCfgPO(30, 15, 3000, 30, 15));
            put(10, new GradeCfgPO(40, 20, 4000, 40, 20));

            put(11, new GradeCfgPO(16, 8, 1600, 16, 8));
        }
    };
    /**
     * 6+ 模式等级配置信息
     */
    public static final Map<Integer, ShortGradeCfgPO> SHORT_GRADE_MAP_CFG = new HashMap<Integer, ShortGradeCfgPO>() {
        private static final long serialVersionUID = 12565667617675L;

        {
            put(1, new ShortGradeCfgPO(0, 0, 1, 100, 2, 1));
            put(2, new ShortGradeCfgPO(0, 0, 2, 200, 4, 2));
            put(3, new ShortGradeCfgPO(0, 0, 5, 500, 10, 5));
            put(4, new ShortGradeCfgPO(0, 0, 10, 1000, 20, 10));
            put(5, new ShortGradeCfgPO(0, 0, 25, 2500, 50, 25));
            put(6, new ShortGradeCfgPO(0, 0, 50, 5000, 100, 50));

            put(7, new ShortGradeCfgPO(0, 0, 3, 300, 6, 3));
            put(8, new ShortGradeCfgPO(0, 0, 4, 400, 8, 4));
            put(9, new ShortGradeCfgPO(0, 0, 15, 1500, 30, 15));
            put(10, new ShortGradeCfgPO(0, 0, 20, 2000, 40, 20));
            put(11, new ShortGradeCfgPO(0, 0, 8, 800, 16, 8));
        }
    };
    public static final short USER_ROLE_ADMIN = (short) 1, USER_ROLE_NONE = (short) 0;
    /**
     * 俱乐部成员身份 :0-普通成员 1-管理员 2-群主
     */
    public static final short CLUB_USER_IDE_GENERAL = 0, CLUB_USER_IDE_MANAGER = 1, CLUB_USER_IDE_MASTER = 2;
    /**
     * 消息审核状态 0-待审核 1-已同意 2-已拒绝 3-已超时
     */
    public static final short MSG_APPLY_STATUS_AUDIT = 0, MSG_APPLY_STATUS_AGREED = 1, MSG_APPLY_STATUS_REFUSED = 2, MSG_APPLY_STATUS_OVER = 3;
    /**
     * 俱乐部状态 0-正常 1-解散
     */
    public static final short CLUB_STATUS_OK = 0, CLUB_STATUS_DISMISS = 1;
    /**
     * 消息类型 0-系统  1-俱乐部消息 2-牌局消息
     */
    public static final short MESSAGE_CLASSIFY_SYS = 0, MESSAGE_CLASSIFY_CLUB = 1, MESSAGE_CLASSIFY_ROOM = 2;
    /**
     * 消息属性 0-系统 1-审批
     */
    public static final short MESSAGE_DISPLAY_TYPE_SYS = 0, MESSAGE_DISPLAY_TYPE_AUDIT = 1;
    /**
     * 俱乐部消息展示范围 0-所有人 1-管理员 2-自己
     */
    public static final short MESSAGE_SHOW_RANGE_ALL = 0, MESSAGE_SHOW_RANGE_ADM = 1, MESSAGE_SHOW_RANGE_SELF = 2;
    /**
     * 消息事务类型 0-入群审核 1-积分带入审核
     */
    public static final short MESSAGE_WORK_TYPE_JOIN = 0, MESSAGE_WORK_TYPE_BRING = 1;
    /**
     * 消息事务处理方式 0-拒绝 1-同意
     */
    public static final short MESSAGE_WORK_OPT_REFUSE = 0, MESSAGE_WORK_OPT_AGREE = 1;
    /**
     * 系统消息doorId
     */
    public static final long SYS_MSG_DOORID = 0;
    public static final int MIN_START_PERSON = 2;
    public static final int USER_CARD_NUMBER = 2;
    public static final int PRE_OPT_TYPE_NONE = 0, PRE_OPT_TYPE_CHECK_OR_FOLD = 1, PRE_OPT_TYPE_CHECK = 2, PRE_OPT_TYPE_CALL = 3, PRE_OPT_TYPE_ALL_IN = 4;
    public static final short DEAL_TYPE_OBTAIN_DIAMOND_BY_BUY = 3000;    //购买获得钻石
    public static final short DEAL_TYPE_DIAMOND_PROLONG = 2001;    //延时消费
    public static final short DEAL_TYPE_DIAMOND_NEW_USER = 2002;//新用户钻石奖励
    public static final short DEAL_TYPE_DIAMOND_LOOK_COMCARD_BY_TABLE = 3010;//桌面看公牌
    public static final short DEAL_TYPE_DIAMOND_LOOK_COMCARD_BY_BACK = 3011;//上局回顾看公牌
    public static final int NEW_USER_DIAMOND_AWARD = 20;//新用户钻石奖励数量
    public static final String DEFAULT_CLUB_ICON = "http://wepoker.cdn.bcebos.com/img/default_club_avatar_v1.png";
    //public static final long AUDIT_BUY_SCORE_TIME = 10500;
    public static final long AUDIT_BUY_SCORE_TIME = 180500;
    public static final long NEED_BUY_SCORE_TIME = 12500;
    public static final long NEXT_OPT_TIME = 12500;
    public static final long CLOSE_ROOM_TIME = 600000;
    public static final int ADD_SCORE_STATUS_SUCCESS = 1;
    public static final int ADD_SCORE_STATUS_NEXT_ADD = 2;
    public static final int ADD_SCORE_STATUS_REJECT = 3;
    public static final int ADD_SCORE_STATUS_AUDIT = 4;
    public static final String NIKE_NAME_FLAG = "nike_name_flag";
    /**
     * 玩法 0-普通 1-6+短牌
     */
    public static final short PLAYTYPE_GENERAL = 0, PLAYTYPE_SHORT = 1, PLAYTYPE_OMAHA = 2;
    public static final short SHORT_COMPARE_TYPE_SHORT = 0, SHORT_COMPARE_TYPE_GENERAL = 1;
    /**
     * omaha手牌数
     */
    public static final int USER_CARD_NUMBER_OMH = 4;
    /**
     * 亮点停留时间
     */
    public static final int LIGHT_STOP_TIME = 2800;
    /**
     * 当前回合加注状态 0：未加注  1：有效加注 -1：无效加注
     */
    public static final Short RAISE_STATE_NONE = 0, RAISE_STATE_VALID = 1, RAISE_STATE_INVALID = -1;
    /**
     * 房间类型 0-俱乐部 1-密码
     */
    public static final Short ROOM_TYPE_CLUB = 0, ROOM_TYPE_NOMAL = 1;
    public static int SESSIONTOKEN_EXP = 86400;//seconds 60*60*24  session缓存24小时


    // ********* 游戏

    /**
     * 游戏类型
     */
    public enum GameType {
        NORMAL("normal"),

        ALL("all"), // 所有游戏
        ;
        public String key;

        GameType(String key) {
            this.key = key;
        }

        public static GameType getGameTypeByKey(String key) {
            for (GameType gameType : GameType.values()) {
                if (gameType.key.equals(key)) {
                    return gameType;
                }
            }
            return null;
        }
    }
}
